home *** CD-ROM | disk | FTP | other *** search
/ Shareware Grab Bag / Shareware Grab Bag.iso / 098 / cstd.arc / CSTD7#5 < prev    next >
Encoding:
Text File  |  1985-07-28  |  7.8 KB  |  170 lines

  1. /* ---------- "mod.std.c Digest V7#5" ---------- */
  2. From: Orlando Sotomayor-Diaz (The Moderator) <cbosgd!std-c>
  3.  
  4.  
  5. mod.std.c Digest            Mon, 24 Jun 85       Volume 7 : Issue   5 
  6.  
  7. Today's Topics:
  8.                         Comment to end of line
  9.                         Miscellaneous comments
  10.                     Pointer math, sizeof, and ints
  11.                  UNIX/WORLD note on & operator change
  12. ----------------------------------------------------------------------
  13.  
  14. Date: Thu, 20 Jun 85 11:32:15 edt
  15. From: Arnold Robbins <gatech!arnold>
  16. Subject: Comment to end of line
  17. To: std-c@cbosgd.UUCP
  18.  
  19. This has been discussed before on net.lang.c, but I don't remember seeing it
  20. in mod.std.c.  Many languages are going with the comment style that uses
  21. a delimiter and goes to the end of a line. Ada is the most recent example,
  22. while the Unix shells, Ratfor, Efl and Make all use the # sign, which
  23. of course is already used by the C language.
  24.  
  25. C++ allows the conventional /* ... */, but also uses // as the here-to-
  26. end-of-line type.  Someone in net.lang.c pointed out that // could
  27. possibly break an existing program. e.g.
  28.  
  29.         x = y //* divide y by z */ z;     
  30.  
  31. I would like to suggest that the standard incorporate this style of comment,
  32. and let :: be the delimiter.  There is no place in K&R C that I can think
  33. of where two adjacent colons are legal, so
  34.  
  35.         x = y ();       :: call y() and assign return value to x
  36.  
  37. would work.  Another alternative would be the @ sign, since C does not
  38. use the @ sign at all.  I would suggest $, but some compilers allow $
  39. as a letter in identifiers, so I'll leave $ alone.
  40.  
  41. These two styles of comment can coexist well, and it also makes it easy
  42. to comment out code with embedded comments in it (yes, I know about using
  43. #ifdef notdef ... #endif; nothing wrong with that, but :: is an alternative).
  44.  
  45. ------------------------------
  46.  
  47. Date: Fri, 21 Jun 85 09:17:34 pdt
  48. From: allegra!sdcrdcf!psivax!friesen (Stanley Friesen)
  49. Subject: Miscellaneous comments
  50. To: sdcrdcf!research!cbosgd!std-c
  51.  
  52.         Well, since I have *finally* received a copy of the Draft
  53. Standard, I will now essay to make a few remarks. Some of these may
  54. have already been commented on, but here goes.
  55.  
  56.         The opening sentence of Section B.2.4.1 is ambiguous as
  57. written, I think it should be rewritten to parallel the opening
  58. sentence of the following section(B.2.4.2). This is a minor nit,
  59. since the the matter is disambiguated later in the document.
  60.  
  61.         As I understand Section C.5.2 (Type specifiers), it
  62. disallows a declaration of "long float", which I think should
  63. be allowed as an equivalent to "double".  This is clearly stated
  64. on pg 93 of K&R. and I see no good reason to depart from the
  65. definition of the language in K&R on this point.
  66.  
  67.         Also, why is the library include file containing the
  68. defines for handling variable parameter lists called *stdarg.h*
  69. instead of "varargs.h"? Is this because the UNIX naming is not
  70. very widespread or what? If this is not the case, it seems to
  71. me that changing its name is a poor decision.
  72. -- 
  73.  
  74.                                 Sarima (Stanley Friesen)
  75.  
  76. {trwrb|allegra|cbosgd|hplabs|ihnp4|aero!uscvax!akgua}!sdcrdcf!psivax!friesen
  77. or {ttdica|quad1|bellcore|scgvaxd}!psivax!friesen
  78.  
  79. ------------------------------
  80.  
  81. Date: Fri, 21 Jun 85 20:36:24 pdt
  82. From: seismo!dual!qantel!vlsvax1!zehntel!tektronix!reed!isonvax!vrs
  83. Subject: Pointer math, sizeof, and ints
  84. To: reed!tektronix!zehntel!vlsvax1!qantel!dual!lll-crg!gymble!umcp-cs!seismo!cbosgd!std-c@gymble.ARPA
  85.  
  86.   I have followed with interest the discussion of the size of the result of
  87. the subtraction of two pointers, and wondered at the lack of discussion of
  88. the size of the result of 'sizeof'.  As has been pointed out before, this
  89. affects machines based on both Intel and Motorola chips and probably some
  90. esoteric hardware as well.
  91.  
  92. > Date: 17 May 85 20:10:13 CDT (Fri)
  93. > From: plus5!hokey (Hokey)
  94. > Subject: Pointer math and ints
  95. > To: std-c@cbosgd
  96. > Changing the result from "an _int_" to "a signed integer (the size of
  97. > which is implementation defined)" breaks existing code.
  98.  
  99. I agree.  I further agree that the bugs introduced by this change are
  100. sometimes hard to detect.  I disagree that the standard should be changed.
  101. My reasoning is that the affected programs are de-facto broken from a
  102. portability perspective, and one objective of coding according to a standard
  103. is certainly a guarantee of portability.
  104.  
  105.   I wonder -- is there any machine on which the difference of two pointers is
  106. not a long?  Most of the machines used by people who complain about this have
  107. int == long == 32 bits.  Is there an obvious advantage to ptr_diff_t and
  108. sizeof_t over long?  This is consistent with the idea of avoiding the use of
  109. int whenever possible in favor of short or long, and saves the introduction
  110. of two new 'types'.  (The people with 'reasonable' hardware could even continue
  111. their sloppy coding practices if they liked 8-)).  Please note that I don't
  112. have any particular interest in the long vs ptr_diff_t decision going either
  113. way (just asking), but I do feel strongly that the difference of two pointers
  114. is not an int.  Please, please, world, think of an int as '16 or more bits'
  115. and not '32 or more bits' for a couple more years!
  116.  
  117. One last thing -- does anybody care that the result of sizeof may be larger
  118. than an unsigned, or did this get beaten to death elsewhere or before I
  119. tuned in?
  120.  
  121. ------------------------------
  122.  
  123. Date: Wed, 19 Jun 85 19:29:25 EDT
  124. From: seismo!elsie!ado
  125. Subject: UNIX/WORLD note on & operator change
  126. To: std-c@cbosgd
  127.  
  128. An article in the July, 1985 issue of UNIX/WORLD magazine describes
  129. a draft standard change in the use of the C language & operator; the
  130. description refers to "time_t", which appears in a header file and is
  131. the type of variables used with the "time" function (among other things):
  132.  
  133.         . . .what if the time_t is an array of ints to hold the time in
  134.         microseconds?  Because the standard allows the compiler vendor to
  135.         define any type to time_t, you cannot write a portable program that
  136.         passed the address of an item defined with a supplied typedef.
  137.         Since you don't necessarily know whether such items are arrays,
  138.         the standard now allows you to use the & operator with array names
  139.         and function names.
  140.  
  141. I'll ignore the issue of why it is that the standard allows the & operator
  142. to be applied to both arrays and functions when the only problem (or rather,
  143. the only problem described above) is with the & operator applied to arrays.
  144. Instead, I'll fret about the fact that allowing the & operator to be applied to
  145. arrays will NOT allow time_t to be typedefed to an array, since variables of
  146. type time_t are returned by standard functions (the function "time" in
  147. particular)--and functions are not allowed to return arrays.  Folks interested
  148. in seeing the problem concretely can run these two lines:
  149.         typedef int     time_t[2];
  150.         extern time_t time();
  151. through their favorite C compiler.
  152.  
  153. Of course, if functions are written so that only pointers to items of a given
  154. type are passed as arguments or returned, then the described change to the &
  155. operator can be of use.  (And if the standard is changed to allow functions to
  156. return arrays, all bets are off.)
  157. --
  158. UNIX is an AT&T Bell Laboratories trademark.
  159. UNIX/WORLD is not affiliated with AT&T Bell Laboratories or Western Electric.
  160. [ Western Electric (RIP)? You mean AT&T Technologies. -- Mod -- ]
  161. --
  162.         UUCP: ..decvax!seismo!elsie!ado    ARPA: elsie!ado@seismo.ARPA
  163.         DEC, VAX and Elsie are Digital Equipment and Borden trademarks
  164.  
  165. ------------------------------
  166.  
  167. End of mod.std.c Digest - Mon, 24 Jun 85 18:37:07 EDT
  168. ******************************
  169.